package com.atguigu.yygh.task.job;

import com.atguigu.yygh.mq.MqConst;
import com.atguigu.yygh.mq.RabbitService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.scheduling.annotation.Scheduled;
import org.springframework.stereotype.Component;

import java.text.SimpleDateFormat;
import java.util.Date;

/*==========================================
      时 间:   2022-04-29
      讲 师:   刘  辉
      描 述:   尚硅谷教学团队
 ==========================================*/
@Component
public class PatientRemind {

    @Autowired
    private RabbitService rabbitService;

    @Scheduled(cron = "*/20 * * * * ?") //CronExpression: 秒 分 时 dayOfMonth Month DayOfWeek Year：七域表达式
    public void remind(){

        SimpleDateFormat sdf =new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
        System.out.println(sdf.format(new Date()));

        rabbitService.sendMessage(MqConst.EXCHANGE_DIRECT_TASK,MqConst.ROUTING_TASK_8,"xxx");

    }
}
